// ignore: file_names
class ChatModel {
  final String chat_id;
  final String detail;
  final String spend_user_id;
  final String receive_user_id;
  final String created_time;
  final bool is_reading;

  ChatModel({
    required this.chat_id,
    required this.detail,
    required this.spend_user_id,
    required this.receive_user_id,
    required this.created_time,
    this.is_reading = false,
  });

  factory ChatModel.fromJson(Map<String, dynamic> json) {
    return ChatModel(
      chat_id: json['chatId'] ?? '',
      detail: json['detail'] ?? '',
      spend_user_id: json['spendUserId'] ?? '',
      receive_user_id: json['receiveUserId'] ?? '',
      created_time: json['createdTime'] ?? '',
      is_reading: json['isReading'] ?? false,
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'chatId': chat_id,
      'detail': detail,
      'spendUserId': spend_user_id,
      'receiveUserId': receive_user_id,
      'createdTime': created_time,
      'isReading': is_reading,
    };
  }

  @override
  String toString() {
    return 'ChatModel{chat_id: $chat_id, detail: $detail, spend_user_id: $spend_user_id, receive_user_id: $receive_user_id, created_time: $created_time, is_reading: $is_reading}';
  }
}
